Radar Chart
Back to Index
Radar Chart
set.seed(123456)
n <- 25
dt <- data.table(
dimension_1 = rpois(n = n, lambda = 20)
, dimension_2 = rpois(n = n, lambda = 10) + 2
, dimension_3 = rpois(n = n, lambda = 30) + 8
, dimension_4 = rpois(n = n, lambda = 40) + 13
, dimension_5 = rpois(n = n, lambda = 5) + 19
, group = rep(LETTERS[1:5], times = 5)
)
rl <- dt[, .(mdn1 = median(dimension_1)
, mdn2 = median(dimension_2)
, mdn3 = median(dimension_3)
, mdn4 = median(dimension_4)
, mdn5 = median(dimension_5))
, by = list(group)
][order(group)]
lbls <- c("I", "II", "III", "IV", "V")
opc <- 0.5
fig <- plot_ly(
type = 'scatterpolar',
fill = 'toself'
)
fig <- fig %>%
add_trace(
r = t(rl[1, 2:6, drop = TRUE])
, theta = lbls
, name = "A"
, opacity = opc
)
fig <- fig %>%
add_trace(
r = t(rl[2, 2:6, drop = TRUE])
, theta = lbls
, name = "B"
, opacity = opc
)
fig <- fig %>%
add_trace(
r = t(rl[3, 2:6, drop = TRUE])
, theta = lbls
, name = "C"
, opacity = opc
)
fig <- fig %>%
add_trace(
r = t(rl[4, 2:6, drop = TRUE])
, theta = lbls
, name = "D"
, opacity = opc
)
fig <- fig %>%
add_trace(
r = t(rl[5, 2:6, drop = TRUE])
, theta = lbls
, name = "E"
, opacity = opc
)
fig <- fig %>%
layout(
polar = list(
radialaxis = list(
visible = T,
range = c(0, 60)
)
)
)
figR sessionInfo
R version 4.2.0 (2022-04-22) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.3 LTS
Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
locale: [1] LC_CTYPE=C.UTF-8 LC_NUMERIC=C LC_TIME=C.UTF-8
[4] LC_COLLATE=C.UTF-8 LC_MONETARY=C.UTF-8 LC_MESSAGES=C.UTF-8
[7] LC_PAPER=C.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C
attached base packages: [1] stats graphics grDevices utils datasets methods base
other attached packages: [1] Wu_0.0.0.9000 flexdashboard_0.5.2 lme4_1.1-29
[4] Matrix_1.4-0 mgcv_1.8-38 nlme_3.1-152
[7] png_0.1-7 scales_1.2.0 nnet_7.3-16
[10] labelled_2.9.1 kableExtra_1.3.4 plotly_4.10.0
[13] gridExtra_2.3 ggplot2_3.3.6 DT_0.23
[16] tableone_0.13.2 magrittr_2.0.3 lubridate_1.8.0
[19] dplyr_1.0.9 plyr_1.8.7 data.table_1.14.2
[22] rmdformats_1.0.4 knitr_1.39
loaded via a namespace (and not attached): [1] httr_1.4.3 sass_0.4.1 tidyr_1.2.0 jsonlite_1.8.0
[5] viridisLite_0.4.0 splines_4.2.0 bslib_0.3.1 assertthat_0.2.1 [9] yaml_2.3.5 pillar_1.8.0 lattice_0.20-45 glue_1.6.2
[13] digest_0.6.29 rvest_1.0.2 minqa_1.2.4 colorspace_2.0-3 [17] htmltools_0.5.3 survey_4.1-1 pkgconfig_2.0.3 haven_2.5.0
[21] bookdown_0.27 purrr_0.3.4 webshot_0.5.3 svglite_2.1.0
[25] tibble_3.1.8 generics_0.1.3 ellipsis_0.3.2 withr_2.5.0
[29] klippy_0.0.0.9500 lazyeval_0.2.2 cli_3.3.0 survival_3.2-13
[33] evaluate_0.15 fansi_1.0.3 MASS_7.3-54 forcats_0.5.1
[37] xml2_1.3.3 tools_4.2.0 hms_1.1.1 mitools_2.4
[41] lifecycle_1.0.1 stringr_1.4.0 munsell_0.5.0 compiler_4.2.0
[45] jquerylib_0.1.4 systemfonts_1.0.4 rlang_1.0.4 grid_4.2.0
[49] nloptr_2.0.3 rstudioapi_0.13 htmlwidgets_1.5.4 crosstalk_1.2.0
[53] rmarkdown_2.14 boot_1.3-28 gtable_0.3.0 DBI_1.1.2
[57] R6_2.5.1 fastmap_1.1.0 utf8_1.2.2 stringi_1.7.8
[61] Rcpp_1.0.9 vctrs_0.4.1 tidyselect_1.1.2 xfun_0.31